package com.etc.medical.feign;


import com.etc.common.utils.Result;
import com.etc.cure.entity.Operation;
import com.etc.medical.client.OperationClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@CrossOrigin(origins = "*")
@RequestMapping("/op")
public class OperationFeign {

    @Resource
    private OperationClient opClient;
    /**
     * 查询职位为手术医生的所有在职医生
     */
    @RequestMapping("/queryOpDoc")
    public Result queryOpDoc() {
        return opClient.queryOpDoc();
    }

    /**
     * 通过医生id获取手术列表
     *
     * @param docId
     * @return
     */
    @RequestMapping("/queryAllByDocId")
    Result queryAllByDocId(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize,@RequestParam("docId") String docId) {
        return opClient.queryAllByDocId(pageNum, pageSize, docId);
    }
    /**
     * 根据门诊Id查询手术信息
     */
    @RequestMapping("/queryByOsId")
    public Result queryByOsId(@RequestParam("osId") String osId) {
        return opClient.queryByOsId(osId);
    }

    /**
     * 新增手术
     *
     * @param operation
     * @return
     */
    @RequestMapping(value = "/insert", method = RequestMethod.POST)
    public Result insert(Operation operation,@RequestParam("operatorId") String operatorId) {
        return opClient.insert(operation,operatorId);
    }

    /**
     * 修改手术详情
     *
     * @param operation
     * @param operatorId
     * @return
     */
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public Result update(Operation operation, @RequestParam("operatorId") String operatorId) {
        return opClient.update(operation, operatorId);
    }

}
